/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.util.HashMap;
import java.util.Map;
import libCore.Util;
import share.ShareMacros;

/**
 *
 * @author Mrkupi
 */
public class Item implements EntityBase{
    
    public String kind;
    public String title;
    public int gold;
    
    public Item()
    {
    }
    
    @Override 
    public Map<String,Object> toAMF()
    {
        Map<String,Object> data = new HashMap<String, Object>();
        
        data.put(ShareMacros.KIND, kind);
        data.put(ShareMacros.GOLD, gold);
        data.put(ShareMacros.TITLE, title);
        
        return data;
    }
    
    @Override 
    public void setData(Map<String, Object> obj)
    {
        Map<String,Object> data = Util.obj2Map(obj);

        kind    =   data.get(ShareMacros.KIND).toString();
        gold    =   Integer.parseInt(data.get(ShareMacros.GOLD).toString());
        title   =   data.get(ShareMacros.EGGS_TIMEBIRTH).toString();
    }
}
